﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;

namespace IceTea.Domain.Models
{
    [MetadataType(typeof(PBIMetadata))]
    public partial class PBI : IValidatableObject
    {
        public class PBIMetadata
        {
            [HiddenInput(DisplayValue=false)]
            public long Id { get; set; }

            [Required(ErrorMessage="Product Id need to be specified")]
            public int ProductId { get; set; }

            [Required(ErrorMessage="Title is required", AllowEmptyStrings=false)]
            [DisplayFormat(ConvertEmptyStringToNull=false)]
            public string Title { get; set; }

            [DisplayFormat(ConvertEmptyStringToNull=false)]
            public string Description { get; set; }

            [Display(Name="Business Value")]
            [DisplayFormat(ConvertEmptyStringToNull=false)]
            public string BusinessValue { get; set; }

            [Display(Name="User Role")]
            [DisplayFormat(ConvertEmptyStringToNull=false)]
            public string UserRole { get; set; }

            [Display(Name="Product Backlog Item Type")]
            [Required(ErrorMessage="PBI Type need to be specified")]
            [Range(0, short.MaxValue, ErrorMessage="Please provide valid PBI Type")]
            public short Type { get; set; }

            [Display(Name="Estimation")]
            public int Estimation { get; set; }

            [Range(0, short.MaxValue, ErrorMessage="Please provide valid Estimation Size Unit")]
            public short SizeUnit { get; set; }

            [Display(Name="Priority")]
            [Required(ErrorMessage="Priority need to be specified")]
            [Range(0, short.MaxValue, ErrorMessage="Please provide valid priority")]
            public short Priority { get; set; }

            [Display(Name="State")]
            [Required(ErrorMessage="State need to be specified")]
            [Range(0, short.MaxValue, ErrorMessage="Please provide valid State")]
            public short State { get; set; }

            [Display(Name="Created By")]
            public int CreatedBy { get; set; }

            [Display(Name="Created Time")]
            public DateTime CreatedTime { get; set; }

            [Display(Name="Updated By")]
            public int UpdatedBy { get; set; }

            [Display(Name="Updated Time")]
            public DateTime UpdatedTime { get; set; }

        }

        #region Implements of IValidatableObject
        public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
        {
            List<ValidationResult> errors = new List<ValidationResult>();
            
            return errors;
        }
        #endregion
    }
}
